package net.dlz.example.LoginHandlerInterceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
    public class Config implements WebMvcConfigurer {

        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            LoginInterceptor loginInterceptor = new LoginInterceptor();
            // 添加拦截的请求，并排除几个不拦截的请求
            registry.addInterceptor(loginInterceptor).addPathPatterns("/**")
                    .excludePathPatterns("/adminLTE/**","/logincss/**","/bootstrap-table/**","/js/**",
                            "/slick/**","/webfonts/**","/css/**","/img/**","/layui/**","/quit","/layer/**","/newsbootstrap/**",
                            "/Admin/Alogin","/Admin/login","/user/tologin","/user/login","index.html","/Email/getCheckCode","/user/mail",
                            "/user/toregister","/user/register","/user/tlogin" ,"/user/tregister","/Email/email");
        }
    }
